////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2012 Kentaro Sekimoto  All rights reserved.
////////////////////////////////////////////////////////////////////////////

#include <tinyhal.h>
#include "..\..\..\..\..\DeviceCode\Targets\Native\FM4\DeviceCode\FM4.h"

//--//

#define SPISWPIN	0

#if (SPISWPIN == 0)
// CLK  P07
// DI   P06
// CS   P74
// RS   P05
// RES  P72
volatile unsigned int* spisw_rs = &(bFM4_GPIO_PDOR0_P05);
volatile unsigned int* spisw_mosi = &(bFM4_GPIO_PDOR0_P06);
volatile unsigned int* spisw_ck = &(bFM4_GPIO_PDOR0_P07);
volatile unsigned int* spisw_cs = &(bFM4_GPIO_PDOR7_P74);
volatile unsigned int* spisw_res = &(bFM4_GPIO_PDOR7_P72);
#endif

void SPISW_GPIO_Initialize(void)
{
#if (SPISWPIN == 0)
    bFM4_GPIO_PFR0_P05 = 0;
    bFM4_GPIO_PFR0_P06 = 0;
    bFM4_GPIO_PFR0_P07 = 0;
    bFM4_GPIO_PFR7_P74 = 0;
    bFM4_GPIO_PFR7_P72 = 0;

    bFM4_GPIO_DDR0_P05 = 1;
    bFM4_GPIO_DDR0_P06 = 1;
    bFM4_GPIO_DDR0_P07 = 1;
    bFM4_GPIO_DDR7_P74 = 1;
    bFM4_GPIO_DDR7_P72 = 1;
#endif
}
